/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import java.util.ArrayList;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.ASalesInputReportCondition;
import com.thor.palmmall.spi.chart.SSalesInputReportCondition;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SSalesInputReportConditionConverter
    implements Converter<ASalesInputReportCondition, SSalesInputReportCondition> {

  public static SSalesInputReportConditionConverter getInstance() {
    if (instance == null)
      instance = new SSalesInputReportConditionConverter();
    return instance;
  }

  private static SSalesInputReportConditionConverter instance;

  private SSalesInputReportConditionConverter() {
  }

  @Override
  public SSalesInputReportCondition convert(ASalesInputReportCondition source) {
    if (source == null) {
      return null;
    }
    SSalesInputReportCondition target = new SSalesInputReportCondition();
    target.setBeginDate(source.getBeginDate());
    target.setEndDate(source.getEndDate());
    target.setStores(new ArrayList<String>());
    target.getStores().addAll(source.getStores());
    return target;
  }

}
